package com.csdj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csdj.mapper.IvInvoiceMapper;
import com.csdj.pojo.IvIninvoice;
import com.csdj.pojo.IvOutinvoice;
import com.csdj.service.IvIninvoiceService;
import com.csdj.mapper.IvIninvoiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.logging.LogManager;

/**
* @author 叶涵
* @description 针对表【iv_ininvoice】的数据库操作Service实现
* @createDate 2023-08-24 15:13:39
*/
@Service
public class IvIninvoiceServiceImpl extends ServiceImpl<IvIninvoiceMapper, IvIninvoice>
    implements IvIninvoiceService{

    @Autowired
    private IvIninvoiceMapper ininvoiceMapper;
    @Override
    public Page<Map> listMap(Page<Map> page) {
        return ininvoiceMapper.listMap(page);
    }

    @Override
    public int countBystartNoAndendNo(int startNo, int endNo) {
        LambdaQueryWrapper<IvIninvoice> lq=new LambdaQueryWrapper<>();
        lq.between(IvIninvoice::getStartNo,startNo,endNo).or().between(IvIninvoice::getEndNo,startNo,endNo).or().le(IvIninvoice::getStartNo,startNo).ge(IvIninvoice::getEndNo,endNo);
        Long l = count(lq);
        int count=l.intValue();

        return count;
    }

    @Override
    public IvIninvoice getOneBystartNoAndendNo(int startNo, int endNo) {
        LambdaQueryWrapper<IvIninvoice> lq=new LambdaQueryWrapper<>();
        lq.between(IvIninvoice::getStartNo,startNo,endNo).or().between(IvIninvoice::getEndNo,startNo,endNo).or().le(IvIninvoice::getStartNo,startNo).ge(IvIninvoice::getEndNo,endNo);
        IvIninvoice in = getOne(lq);
        return in;
    }



}




